package sketch.issta11.specifystatements;

import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;

//import sketch.icse11nier.Z_Sketch_SpecifyAssertions.List;
import sketch.ounit.Observer;
import sketch.ounit.Values;
import sketch.specs.annotation.TestSketch;
import junit.framework.TestCase;

public class Z_ChooseAllOrNoneStatement_Example extends TestCase {
	
	@TestSketch
	public void testChooseAllOrNone() {
		{/*@ChooseAllOrNone*/
			foo();
		}
		bar();
	}
	
	@TestSketch
	public void testChooseAllOrNone_nested() {
		{/*@ChooseAllOrNone*/
			{/*@ChooseAllOrNone*/
				foo();
			}
			bar();
		}
	}
	
	@TestSketch
	public void testChooseAllOrNone_mix_One() {
		{/*@ChooseOne*/
			foo();
			{/*@ChooseAllOrNone*/
				bar();
			}
		}
	}
	
	@TestSketch
	public void testChooseAllOrNone_mix_ChooseValue() {
		int x = Values.choose(1, 2, 3);
		{/*@ChooseOne*/
			foo();
			bar();
			bar(x);
		}
	}
	
	@TestSketch
	public void testChooseOne_mix_TryCatch() {
		try {
			int x = Values.choose(1, 2);
			{/*@ChooseOne*/
				foo();
				bar(x);
			}
		} catch(Exception e) {
			//skip
		}
	}
	
	@TestSketch
	public void testChooseMultipleAll() {
		List<String> l = new LinkedList<String>();
		{/*@ChooseAllOrNone*/
			List<String> l1 = new LinkedList<String>();
			l1.add("a");
			l1.add("b");
			l1.add("c");
			l.addAll(l1);
		}
		System.out.println(l.size());
	}
	
//	@TestSketch public void testEntrySetContains_rewrite() {
//        bar();
//        {/*@ChooseOneOrNone*/
//            foo();
//         }
//        {/*@ChooseOneOrNone*/
//        	HashMap temp = new HashMap();
//            bar(1);
//            bar(2);
//        }
//        bar(3);
//    }
	
	public void foo() {}
	public void bar() {}
	public void bar(int i) {}
	
}
